#include "common.h"

const char * fName;
int line;

bool prepare (const char * fname, int _line) {
	fName = fname;
	line = _line;
	return true;
}

bool trace(char *format, ...)
{
	FILE * f = fopen ("trace.log", "at");
    va_list ap;
    va_start(ap, format);
    /* print out name of function causing error */
	(void) fprintf(f, "%s(%d):\t\t ", fName, line);
    /* print out remainder of message */
    (void) vfprintf(f, format, ap);
	(void) fprintf(f, "\n");
    va_end(ap);
    fclose (f);
	return true;
}